home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / Drivers / Fd / Test.sh < prev   
Linux/UNIX/POSIX Shell Script  |  1995-12-31  |  1KB  |  38 lines

  1. #! /bin/sh
  2. #    Name: perform tests of the File Descriptor driver
  3. #    Author: Mark Salyzyn    CopyRight Dec 1995
  4. #
  5. for i in 1 2 3 4 5 6 7 8 9 ; do
  6.     if test -s $i ; then
  7.         echo Too Dangerous to test >/dev/stderr
  8.         exit
  9.     fi
  10. done
  11. ( echo one >&1 ; echo two >&2 ; echo three >&3 ; echo four >&4 ; echo five >&5 ; echo six >&6 ; echo seven >&7 ; echo eight >&8 ; echo nine >&9 ) >1 2>2 3>3 4>4 5>5 6>6 7>7 8>8 9>9
  12. echo -n "If the test worked, nothing here ->"
  13. ( ls -l 1 2 3 4 5 6 7 8 9 | sed "s/^[^ ]* *[0-9]* *[^ ]* *\([0-9]*\) *.*\([1-9]\)\$/\2    \1/" ) | cmp /dev/stdin /dev/fd/4 4<<!!!
  14. 1    4
  15. 2    4
  16. 3    6
  17. 4    5
  18. 5    5
  19. 6    4
  20. 7    6
  21. 8    6
  22. 9    5
  23. !!!
  24. rm -f 1 2 3 4 5 6 7 8 9
  25. echo
  26. echo Found the following links:
  27. echo -n "    /dev/fd/0 -> "
  28. echo -n /dev/stdin >/dev/stdin
  29. echo
  30. echo -n "    /dev/fd/1 -> "
  31. echo -n /dev/stdout >/dev/stdout
  32. echo "        <- If empty, only because of Bug in this driver"
  33. echo -n "    /dev/fd/2 -> "
  34. echo -n /dev/stderr >/dev/stderr
  35. echo
  36. echo And the following descriptors in /dev/fd/:
  37. ls /dev/fd | sort -n | xargs -s80 echo "        "
  38.